@extends('admin')
@section('content')
<div class="nav">
    <ul class="cc">
        <li class="current">
            <a href="{{url('admin/sys/setting')}}">系统参数</a>
        </li>
    </ul>
</div>
<form action="{{url('admin/sys/setting')}}" method="POST" class="J_ajaxForm">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
@foreach($configs as $c)
<div class="h_a">{{$c['title']}}</div>
<div class="table_full">
    <table width="100%">
        <colgroup>
            <col class="th">
            <col width="400">
            <col>
        </colgroup>
        <tbody>
        @foreach($c['options'] as $key => $item)
        @if (is_array($item))
        <tr>
            <th><label for="cfg_{{$key}}">{{$item['title']}}</label></th>
            <td>
                @if ($item['type'] == 'textarea')
                <textarea name="Configs[{{$key}}][val]" id="cfg_{{$key}}" class="{{$item['class']}}" @if(isset($item['style'])) style="{{$item['style']}}"@endif>{{$models[$key]->val}}</textarea>
                @elseif ($item['type'] == 'select')
                <select name="Configs[{{$key}}][val]" id="cfg_{{$key}}">
                    @foreach($item['data'] as $v => $txt)
                    <option value="{{$v}}" @if ($v == $models[$key]->val) selected="selected" @endif>{{$txt}}</option>
                    @endforeach
                </select>
                @elseif ($item['type'] == 'number')
                <input type="number" name="Configs[{{$key}}][val]" id="cfg_{{$key}}" value="{{$models[$key]->val}}" class="{{$item['class']}}" @if(isset($item['style'])) style="{{$item['style']}}"@endif />
                @elseif ($item['type'] == 'password')
                <input type="password" name="Configs[{{$key}}][val]" id="cfg_{{$key}}" value="{{$models[$key]->val}}" class="{{$item['class']}}" @if(isset($item['style'])) style="{{$item['style']}}"@endif />
                @else
                <input type="text" name="Configs[{{$key}}][val]" id="cfg_{{$key}}" value="{{$models[$key]->val}}" class="{{$item['class']}}" @if(isset($item['style'])) style="{{$item['style']}}"@endif />
                @endif
                @if (isset($item['unit'])) {{$item['unit']}} @endif
            </td>
            <td>
                @if (isset($item['tips']))
                    <div class="cc">{{$item['tips']}}</div>
                @endif
            </td>


        </tr>
        @else
        <tr>
            <th><?php echo $form->labelEx($model, 'name'); ?></th>
            <td>
                <?php echo $form->textField($model, 'name', array('class' => 'input length_3'));?>
                <?php echo $form->error($model, 'name'); ?>
            </td>
            <td>
                <?php echo $form->error($model, "[$key]value"); ?>
                <div class="gray"><?php echo $c['options'][$key]['tips'];?></div>
            </td>
        </tr>
        @endif
        @endforeach
        </tbody>
    </table>
</div>
@endforeach

<div class="btn_wrap">
    <div class="btn_wrap_pd">
        <button type="submit" class="btn btn_submit mr10 J_ajax_submit_btn">提交</button>
    </div>
</div>
</form>
@stop